package com.wqc.dynaproxy;

// 记录性能监视类 MethodPerformance
public class MethodPerformance {
    private long begin;
    private long end;
    private String serviceMethod;

    // 构造函数
    public MethodPerformance(String serviceMethod){
        this.serviceMethod = serviceMethod;
        // 程序执行的开始时间
        this.begin = System.currentTimeMillis();
    }

    // 打印方法执行消耗的时间
    public void printPerformance(){
        end = System.currentTimeMillis();
        long elapse = end - begin;
        System.out.println(serviceMethod + " 花费 " + elapse + "毫秒");
    }
}
